<!DOCTYPE html>
<html lang="ch">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //从1到500所有自然数中不含数字4的自然数共有多少个？
        function pad(n){
        var num=0;
        for(i=1;i<=n;i++){
            let str=i.toString();
            if(str.indexOf("4")==-1){
                console.log(i);
                num++;
            }
        }
        console.log(num);
    }
    console.log(pad(500))
    </script>
</body>
</html>